#include "sqlist.h"

void print_list(SqList L) {
	for(int i=0; i<L.length; i++) {
		cout<<L.elem[i]<<" ";
	}
	cout<<endl;
}
void print_message(string s) {
	cout<<s<<" ";
}
void print_error(string s) {
	cout<<s<<endl;
}
int main() {
	SqList L,P;
	if(!InitList_Sq(L)) {
		print_error("初始化失败，请重试");
		return 0;
	}
	InitList_Sq(P);
	int s[] = {12,13,21,24,28,30,42,77};
	for(int i=0; i<8; i++) {
		ListInsert_Sq(L,i+1,s[i]);
	}
	for(int i=0; i<8; i++) {
		ListInsert_Sq(P,i+1,s[i]);
	}
	print_message("插入初值后的链表：");
	print_list(L);
//	12,13,21,24,28,30,42,77
	if(!LocateElem_Sq(L,25)) {
		ListInsert_Sq(L,5,25);
	}

	print_message("插入25后的链表：");
	print_list(L);
	ListDelete_Sq(L,4);
	print_message("删除i=4元素的链表：");
	print_list(L);

	ListUnion_Sq(L,P);
}



